package sge.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sge.beans.Fachada;
import sge.beans.Instituicao;

public class InstituicaoServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String instituicao = request.getParameter("instituicao");
		String sigla = request.getParameter("sigla");
		Instituicao nova_instituicao = new Instituicao();
		nova_instituicao.setNome(instituicao);
		nova_instituicao.setSigla(sigla);
		Fachada fachada = Fachada.obterInstancia();
		fachada.inserirInstituicao(nova_instituicao);
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("/feedback/cadastro_efetuado.jsp");
		dispatcher.forward(request, response);
	}
	
	

}
